package com.generate.control;

import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import jregex.Pattern;

import com.generate.library.ComponentUtils;
import com.generate.library.FileUtils;
import com.generate.library.GenerateUtils;


public class JPanelVariant extends JPanel
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static JPanelVariant panelVariantCopy = null;
	private JTextFieldReplace rfVariantCode;
	private JTextFieldReplace tfVariantName;
	private JTextFieldReplace tfvariantPrices;
	private JTextFieldReplace tfVariantWasPrices;
	private JTextFieldReplace tfVariantImageName;
	private JTextFieldReplace tfVariantPromotion;
	private JTextFieldReplace tfVariantSummary;
	private JTextFieldReplace tfSummaryRichText;
	private JLabel lblNewLabel;
	private JLabel lblVariantName;
	private JLabel lblVariantPrices;
	private JLabel lblVariantWasPrices;
	private JLabel lblVariantImageName;
	private JLabel lblVariantPromotion;
	private JLabel lblVariantSummary;
	private JLabel lblVariantSummaryRich;
	private JButton btnVariantCode;
	private JButton btnVariantName;
	private JButton btnvariantPrices;
	private JButton btnVariantWasPrices;
	private JButton btnVariantImageName;
	private JButton btnVariantPromotion;
	private JButton btnVariantSummary;
	private JButton btnSummaryRichText;
	private JPanel panel;
	private JButton btnCopy;
	private JButton btnPaste;
	private JLabel lblNewLabel_1;
	private JLabel lblNewLabel_2;
	private JLabel lblwxh;
	private JLabel lblwxh_1;
	private JLabel lblwxh_2;
	private JLabel lblwxh_3;
	private JLabel lblwxh_4;
	private JLabel lblwxh_5;
	private JLabel lblwxh_6;
	private JLabel lblwxh_7;
	private JLabel lblwxh_8;
	private JLabel lblwxh_9;
	private JLabel lblImages;
	private JImageName image96x96_1;
	private JImageName image125x90;
	private JImageName image128x114;
	private JImageName image128x85;
	private JImageName image130x130;
	private JImageName image130x80;
	private JImageName image138x80;
	private JImageName image164x115;
	private JImageName image220x120;
	private JImageName image300x180;
	private JImageName image30x32;
	private JImageName image300x300_1;

	private final Map<String, IReplace> mapStringIReplace = new HashMap<String, IReplace>();
	private JPanel panel_1;
	private JLabel lblImageFolder;
	private JButton btnUpdate;
	private JTextFieldReplace tfImageFolder;
	private JImageName image96x96_2;
	private JImageName image96x96_3;
	private JImageName image300x300_2;
	private JImageName image300x300_3;
	private JCheckFlagBlock checkImage96x96;
	private JCheckFlagBlock checkImage125x90;
	private JCheckFlagBlock checkImage128x114;
	private JCheckFlagBlock checkImage128x85;
	private JCheckFlagBlock checkImage130x130;
	private JCheckFlagBlock checkImage130x80;
	private JCheckFlagBlock checkImage138x80;
	private JCheckFlagBlock checkImage164x115;
	private JCheckFlagBlock checkImage220x120;
	private JCheckFlagBlock checkImage300x180;
	private JCheckFlagBlock checkImage30x32;
	private JCheckFlagBlock checkImage300x300;
	private JButton btnCopyImage;

	public JPanelVariant(int variantNumber)
	{
		super();
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]
		{ 0, 0, 0, 0 };
		gridBagLayout.rowHeights = new int[]
		{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
		gridBagLayout.columnWeights = new double[]
		{ 0.0, 1.0, 0.0, Double.MIN_VALUE };
		gridBagLayout.rowWeights = new double[]
		{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
				0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
		setLayout(gridBagLayout);

		lblNewLabel = new JLabel("Variant code");
		GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
		gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel.gridx = 0;
		gbc_lblNewLabel.gridy = 0;
		add(lblNewLabel, gbc_lblNewLabel);

		rfVariantCode = new JTextFieldReplace();
		rfVariantCode.setFindText("@VARIANT_{0}_CODE@");
		GridBagConstraints gbc_rfVariantCode = new GridBagConstraints();
		gbc_rfVariantCode.insets = new Insets(0, 0, 5, 5);
		gbc_rfVariantCode.fill = GridBagConstraints.HORIZONTAL;
		gbc_rfVariantCode.gridx = 1;
		gbc_rfVariantCode.gridy = 0;
		add(rfVariantCode, gbc_rfVariantCode);

		btnVariantCode = new JButton("Paste");
		btnVariantCode.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				if (panelVariantCopy != null)
				{
					JPanelVariant.this.rfVariantCode.setText(panelVariantCopy.rfVariantCode.getText());
				}
			}
		});
		GridBagConstraints gbc_btnVariantCode = new GridBagConstraints();
		gbc_btnVariantCode.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnVariantCode.insets = new Insets(0, 0, 5, 0);
		gbc_btnVariantCode.gridx = 2;
		gbc_btnVariantCode.gridy = 0;
		add(btnVariantCode, gbc_btnVariantCode);

		lblVariantName = new JLabel("Variant name");
		GridBagConstraints gbc_lblVariantName = new GridBagConstraints();
		gbc_lblVariantName.insets = new Insets(0, 0, 5, 5);
		gbc_lblVariantName.anchor = GridBagConstraints.EAST;
		gbc_lblVariantName.gridx = 0;
		gbc_lblVariantName.gridy = 1;
		add(lblVariantName, gbc_lblVariantName);

		tfVariantName = new JTextFieldReplace();
		tfVariantName.setFindText("@VARIANT_{0}_NAME@");
		GridBagConstraints gbc_tfVariantName = new GridBagConstraints();
		gbc_tfVariantName.anchor = GridBagConstraints.NORTH;
		gbc_tfVariantName.insets = new Insets(0, 0, 5, 5);
		gbc_tfVariantName.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfVariantName.gridx = 1;
		gbc_tfVariantName.gridy = 1;
		add(tfVariantName, gbc_tfVariantName);

		btnVariantName = new JButton("Paste");
		btnVariantName.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				JPanelVariant.this.tfVariantName.setText(panelVariantCopy.tfVariantName.getText());
			}
		});
		GridBagConstraints gbc_btnVariantName = new GridBagConstraints();
		gbc_btnVariantName.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnVariantName.insets = new Insets(0, 0, 5, 0);
		gbc_btnVariantName.gridx = 2;
		gbc_btnVariantName.gridy = 1;
		add(btnVariantName, gbc_btnVariantName);

		lblVariantPrices = new JLabel("Variant prices");
		GridBagConstraints gbc_lblVariantPrices = new GridBagConstraints();
		gbc_lblVariantPrices.insets = new Insets(0, 0, 5, 5);
		gbc_lblVariantPrices.anchor = GridBagConstraints.EAST;
		gbc_lblVariantPrices.gridx = 0;
		gbc_lblVariantPrices.gridy = 2;
		add(lblVariantPrices, gbc_lblVariantPrices);

		tfvariantPrices = new JTextFieldReplace();
		tfvariantPrices.setText("1 USA, 1 CNY");
		tfvariantPrices.setFindText("@VARIANT_{0}_PRICES@");
		GridBagConstraints gbc_tfvariantPrices = new GridBagConstraints();
		gbc_tfvariantPrices.insets = new Insets(0, 0, 5, 5);
		gbc_tfvariantPrices.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfvariantPrices.gridx = 1;
		gbc_tfvariantPrices.gridy = 2;
		add(tfvariantPrices, gbc_tfvariantPrices);

		btnvariantPrices = new JButton("Paste");
		btnvariantPrices.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				JPanelVariant.this.tfvariantPrices.setText(panelVariantCopy.tfvariantPrices.getText());
			}
		});
		GridBagConstraints gbc_btnvariantPrices = new GridBagConstraints();
		gbc_btnvariantPrices.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnvariantPrices.insets = new Insets(0, 0, 5, 0);
		gbc_btnvariantPrices.gridx = 2;
		gbc_btnvariantPrices.gridy = 2;
		add(btnvariantPrices, gbc_btnvariantPrices);

		lblVariantWasPrices = new JLabel("Variant was prices");
		GridBagConstraints gbc_lblVariantWasPrices = new GridBagConstraints();
		gbc_lblVariantWasPrices.insets = new Insets(0, 0, 5, 5);
		gbc_lblVariantWasPrices.anchor = GridBagConstraints.EAST;
		gbc_lblVariantWasPrices.gridx = 0;
		gbc_lblVariantWasPrices.gridy = 3;
		add(lblVariantWasPrices, gbc_lblVariantWasPrices);

		tfVariantWasPrices = new JTextFieldReplace();
		tfVariantWasPrices.setFindText("@VARIANT_{0}_WAS_PRICES@");
		GridBagConstraints gbc_tfVariantWasPrices = new GridBagConstraints();
		gbc_tfVariantWasPrices.insets = new Insets(0, 0, 5, 5);
		gbc_tfVariantWasPrices.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfVariantWasPrices.gridx = 1;
		gbc_tfVariantWasPrices.gridy = 3;
		add(tfVariantWasPrices, gbc_tfVariantWasPrices);

		btnVariantWasPrices = new JButton("Paste");
		btnVariantWasPrices.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				JPanelVariant.this.tfVariantWasPrices.setText(panelVariantCopy.tfVariantWasPrices.getText());
			}
		});
		GridBagConstraints gbc_btnVariantWasPrices = new GridBagConstraints();
		gbc_btnVariantWasPrices.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnVariantWasPrices.insets = new Insets(0, 0, 5, 0);
		gbc_btnVariantWasPrices.gridx = 2;
		gbc_btnVariantWasPrices.gridy = 3;
		add(btnVariantWasPrices, gbc_btnVariantWasPrices);

		lblVariantPromotion = new JLabel("Variant promotion");
		GridBagConstraints gbc_lblVariantPromotion = new GridBagConstraints();
		gbc_lblVariantPromotion.insets = new Insets(0, 0, 5, 5);
		gbc_lblVariantPromotion.anchor = GridBagConstraints.EAST;
		gbc_lblVariantPromotion.gridx = 0;
		gbc_lblVariantPromotion.gridy = 4;
		add(lblVariantPromotion, gbc_lblVariantPromotion);

		tfVariantPromotion = new JTextFieldReplace();
		tfVariantPromotion.setFindText("@VARIANT_{0}_PROMOTION_TEXT@");
		GridBagConstraints gbc_tfVariantPromotion = new GridBagConstraints();
		gbc_tfVariantPromotion.insets = new Insets(0, 0, 5, 5);
		gbc_tfVariantPromotion.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfVariantPromotion.gridx = 1;
		gbc_tfVariantPromotion.gridy = 4;
		add(tfVariantPromotion, gbc_tfVariantPromotion);

		btnVariantPromotion = new JButton("Paste");
		btnVariantPromotion.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				JPanelVariant.this.tfVariantPromotion.setText(panelVariantCopy.tfVariantPromotion.getText());
			}
		});
		GridBagConstraints gbc_btnVariantPromotion = new GridBagConstraints();
		gbc_btnVariantPromotion.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnVariantPromotion.insets = new Insets(0, 0, 5, 0);
		gbc_btnVariantPromotion.gridx = 2;
		gbc_btnVariantPromotion.gridy = 4;
		add(btnVariantPromotion, gbc_btnVariantPromotion);

		lblVariantSummary = new JLabel("Variant summary");
		GridBagConstraints gbc_lblVariantSummary = new GridBagConstraints();
		gbc_lblVariantSummary.insets = new Insets(0, 0, 5, 5);
		gbc_lblVariantSummary.anchor = GridBagConstraints.EAST;
		gbc_lblVariantSummary.gridx = 0;
		gbc_lblVariantSummary.gridy = 5;
		add(lblVariantSummary, gbc_lblVariantSummary);

		tfVariantSummary = new JTextFieldReplace();
		tfVariantSummary.setFindText("@VARIANT_{0}_SUMMARY@");
		GridBagConstraints gbc_tfVariantSummary = new GridBagConstraints();
		gbc_tfVariantSummary.insets = new Insets(0, 0, 5, 5);
		gbc_tfVariantSummary.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfVariantSummary.gridx = 1;
		gbc_tfVariantSummary.gridy = 5;
		add(tfVariantSummary, gbc_tfVariantSummary);

		btnVariantSummary = new JButton("Paste");
		btnVariantSummary.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				JPanelVariant.this.tfVariantSummary.setText(panelVariantCopy.tfVariantSummary.getText());
			}
		});
		GridBagConstraints gbc_btnVariantSummary = new GridBagConstraints();
		gbc_btnVariantSummary.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnVariantSummary.insets = new Insets(0, 0, 5, 0);
		gbc_btnVariantSummary.gridx = 2;
		gbc_btnVariantSummary.gridy = 5;
		add(btnVariantSummary, gbc_btnVariantSummary);

		lblVariantSummaryRich = new JLabel("Variant summary rich text");
		GridBagConstraints gbc_lblVariantSummaryRich = new GridBagConstraints();
		gbc_lblVariantSummaryRich.insets = new Insets(0, 0, 5, 5);
		gbc_lblVariantSummaryRich.anchor = GridBagConstraints.EAST;
		gbc_lblVariantSummaryRich.gridx = 0;
		gbc_lblVariantSummaryRich.gridy = 6;
		add(lblVariantSummaryRich, gbc_lblVariantSummaryRich);

		tfSummaryRichText = new JTextFieldReplace();
		tfSummaryRichText.setFindText("@VARIANT_{0}_SUMMARY_RICH_TEXT@");
		GridBagConstraints gbc_tfSummaryRichText = new GridBagConstraints();
		gbc_tfSummaryRichText.insets = new Insets(0, 0, 5, 5);
		gbc_tfSummaryRichText.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfSummaryRichText.gridx = 1;
		gbc_tfSummaryRichText.gridy = 6;
		add(tfSummaryRichText, gbc_tfSummaryRichText);

		btnSummaryRichText = new JButton("Paste");
		btnSummaryRichText.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				JPanelVariant.this.tfSummaryRichText.setText(panelVariantCopy.tfSummaryRichText.getText());
			}
		});
		GridBagConstraints gbc_btnSummaryRichText = new GridBagConstraints();
		gbc_btnSummaryRichText.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnSummaryRichText.insets = new Insets(0, 0, 5, 0);
		gbc_btnSummaryRichText.gridx = 2;
		gbc_btnSummaryRichText.gridy = 6;
		add(btnSummaryRichText, gbc_btnSummaryRichText);

		panel_1 = new JPanel();
		GridBagConstraints gbc_panel_1 = new GridBagConstraints();
		gbc_panel_1.insets = new Insets(0, 0, 5, 5);
		gbc_panel_1.fill = GridBagConstraints.BOTH;
		gbc_panel_1.gridx = 1;
		gbc_panel_1.gridy = 7;
		add(panel_1, gbc_panel_1);
		GridBagLayout gbl_panel_1 = new GridBagLayout();
		gbl_panel_1.columnWidths = new int[]
		{ 320, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
		gbl_panel_1.rowHeights = new int[]
		{ 0, 0 };
		gbl_panel_1.columnWeights = new double[]
		{ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		gbl_panel_1.rowWeights = new double[]
		{ 0.0, Double.MIN_VALUE };
		panel_1.setLayout(gbl_panel_1);

		btnCopy = new JButton("Copy");
		GridBagConstraints gbc_btnCopy = new GridBagConstraints();
		gbc_btnCopy.insets = new Insets(0, 0, 0, 5);
		gbc_btnCopy.gridx = 11;
		gbc_btnCopy.gridy = 0;
		panel_1.add(btnCopy, gbc_btnCopy);
		btnCopy.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				copy();
			}
		});

		btnPaste = new JButton("Paste");
		GridBagConstraints gbc_btnPaste = new GridBagConstraints();
		gbc_btnPaste.gridx = 12;
		gbc_btnPaste.gridy = 0;
		panel_1.add(btnPaste, gbc_btnPaste);
		btnPaste.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				paste();
			}

		});

		lblImages = new JLabel("IMAGES");
		GridBagConstraints gbc_lblImages = new GridBagConstraints();
		gbc_lblImages.insets = new Insets(0, 0, 5, 5);
		gbc_lblImages.gridx = 1;
		gbc_lblImages.gridy = 8;
		add(lblImages, gbc_lblImages);

		btnCopyImage = new JButton("Copy image");
		btnCopyImage.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				for (JImageName image : ComponentUtils.getAllComponents(JPanelVariant.this, JImageName.class))
				{
					String imagePath = GenerateUtils.replace("@MSSCN-FOLDER@")
							+ "\\bin\\ext-mss\\msscn\\msscninitialdata\\resources\\msscninitialdata\\import\\productCatalogs\\msscnProductCatalog\\images\\";
					if (image.getText() != null && image.getText().length() > 0)
					{
						String folderName = image.getText().replaceAll(".*?(\\d+)x(\\d+)(_\\d)?\\.png", "$1Wx$2H").toUpperCase();
						String fileName = image.getText();
						if ((image.equals(image96x96_1) || image.equals(image300x300_1)) && fileName.matches(".*?(\\d+)x(\\d+)\\.png"))
						{
							fileName = fileName.replace(".png", "_1.png");
						}
						imagePath += folderName + "\\" + fileName;
						imagePath.replace("\\\\", "\\");
						try
						{
							FileUtils.copyFile(new File(image.getFileFullPath()), new File(imagePath));
						}
						catch (IOException e1)
						{
							// TODO Auto-generated catch block
							e1.printStackTrace();
						}
					}
				}
			}
		});
		GridBagConstraints gbc_btnCopyImage = new GridBagConstraints();
		gbc_btnCopyImage.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnCopyImage.insets = new Insets(0, 0, 5, 0);
		gbc_btnCopyImage.gridx = 2;
		gbc_btnCopyImage.gridy = 8;
		add(btnCopyImage, gbc_btnCopyImage);

		lblVariantImageName = new JLabel("Variant image name");
		GridBagConstraints gbc_lblVariantImageName = new GridBagConstraints();
		gbc_lblVariantImageName.insets = new Insets(0, 0, 5, 5);
		gbc_lblVariantImageName.anchor = GridBagConstraints.EAST;
		gbc_lblVariantImageName.gridx = 0;
		gbc_lblVariantImageName.gridy = 9;
		add(lblVariantImageName, gbc_lblVariantImageName);

		tfVariantImageName = new JTextFieldReplace();
		tfVariantImageName.setFindText("@VARIANT_{0}_IMAGE_NAME@");
		GridBagConstraints gbc_tfVariantImageName = new GridBagConstraints();
		gbc_tfVariantImageName.insets = new Insets(0, 0, 5, 5);
		gbc_tfVariantImageName.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfVariantImageName.gridx = 1;
		gbc_tfVariantImageName.gridy = 9;
		add(tfVariantImageName, gbc_tfVariantImageName);

		btnVariantImageName = new JButton("Paste");
		btnVariantImageName.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				JPanelVariant.this.tfVariantImageName.setText(panelVariantCopy.tfVariantImageName.getText());
			}
		});
		GridBagConstraints gbc_btnVariantImageName = new GridBagConstraints();
		gbc_btnVariantImageName.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnVariantImageName.insets = new Insets(0, 0, 5, 0);
		gbc_btnVariantImageName.gridx = 2;
		gbc_btnVariantImageName.gridy = 9;
		add(btnVariantImageName, gbc_btnVariantImageName);

		lblImageFolder = new JLabel("Image folder");
		GridBagConstraints gbc_lblImageFolder = new GridBagConstraints();
		gbc_lblImageFolder.insets = new Insets(0, 0, 5, 5);
		gbc_lblImageFolder.anchor = GridBagConstraints.EAST;
		gbc_lblImageFolder.gridx = 0;
		gbc_lblImageFolder.gridy = 10;
		add(lblImageFolder, gbc_lblImageFolder);

		tfImageFolder = new JTextFieldReplace();
		tfImageFolder.setFindText("@VARIANT_{0}_IMAGE_FOLDER@");
		GridBagConstraints gbc_tfImageFolder = new GridBagConstraints();
		gbc_tfImageFolder.insets = new Insets(0, 0, 5, 5);
		gbc_tfImageFolder.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfImageFolder.gridx = 1;
		gbc_tfImageFolder.gridy = 10;
		add(tfImageFolder, gbc_tfImageFolder);

		btnUpdate = new JButton("Update");
		btnUpdate.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent arg0)
			{
				for (JImageName imageName : ComponentUtils.getAllComponents(JPanelVariant.this, JImageName.class))
				{
					imageName.setText("");
					if (imageName.getCheckFlagBlock() != null)
					{
						imageName.getCheckFlagBlock().setSelected(false);
					}
				}
				new Thread(new Runnable()
				{

					@Override
					public void run()
					{
						for (File file : GenerateUtils.listFilesForFolder(new File(tfImageFolder.getReplaceText())))
						{
							for (JImageName imageName : ComponentUtils.getAllComponents(JPanelVariant.this, JImageName.class))
							{
								Pattern pattern = new Pattern(GenerateUtils.replace(imageName.getMatchText()));
								if (pattern.matches(file.getName()))
								{
									imageName.setText(file.getName());
									imageName.setFileFullPath(file.getPath());
									if (imageName.getCheckFlagBlock() != null)
									{
										imageName.getCheckFlagBlock().setSelected(true);
									}
								}
							}

						}
					}
				}, "update").start();
			}
		});
		GridBagConstraints gbc_btnUpdate = new GridBagConstraints();
		gbc_btnUpdate.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnUpdate.insets = new Insets(0, 0, 5, 0);
		gbc_btnUpdate.gridx = 2;
		gbc_btnUpdate.gridy = 10;
		add(btnUpdate, gbc_btnUpdate);

		lblNewLabel_1 = new JLabel("96Wx96H");
		GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
		gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_1.gridx = 0;
		gbc_lblNewLabel_1.gridy = 11;
		add(lblNewLabel_1, gbc_lblNewLabel_1);

		image96x96_1 = new JImageName();
		image96x96_1.setMatchText("@VARIANT_{0}_IMAGE_NAME@104x104(?:_1)?.png");
		image96x96_1.setFindText("@IMAGE_FILE_{0}_96Wx96H_1@");
		GridBagConstraints gbc_image96x96_1 = new GridBagConstraints();
		gbc_image96x96_1.insets = new Insets(0, 0, 5, 5);
		gbc_image96x96_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_image96x96_1.gridx = 1;
		gbc_image96x96_1.gridy = 11;
		add(image96x96_1, gbc_image96x96_1);

		checkImage96x96 = new JCheckFlagBlock();
		checkImage96x96.setTrueText("$1");
		checkImage96x96.setFindText("@IMAGE_FILE_BLOCK_{0}_96Wx96H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_96Wx96H:END@");
		GridBagConstraints gbc_checkFlagBlock_1 = new GridBagConstraints();
		gbc_checkFlagBlock_1.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_1.gridx = 2;
		gbc_checkFlagBlock_1.gridy = 11;
		add(checkImage96x96, gbc_checkFlagBlock_1);

		image96x96_2 = new JImageName();
		image96x96_2.setMatchText("@VARIANT_{0}_IMAGE_NAME@104x104(?:_2).png");
		image96x96_2.setFindText("@IMAGE_FILE_{0}_96Wx96H_2@");
		GridBagConstraints gbc_image96x96_2 = new GridBagConstraints();
		gbc_image96x96_2.insets = new Insets(0, 0, 5, 5);
		gbc_image96x96_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_image96x96_2.gridx = 1;
		gbc_image96x96_2.gridy = 12;
		add(image96x96_2, gbc_image96x96_2);

		image96x96_3 = new JImageName();
		image96x96_3.setMatchText("@VARIANT_{0}_IMAGE_NAME@104x104(?:_3).png");
		image96x96_3.setFindText("@IMAGE_FILE_{0}_96Wx96H_3@");
		GridBagConstraints gbc_image96x96_3 = new GridBagConstraints();
		gbc_image96x96_3.insets = new Insets(0, 0, 5, 5);
		gbc_image96x96_3.fill = GridBagConstraints.HORIZONTAL;
		gbc_image96x96_3.gridx = 1;
		gbc_image96x96_3.gridy = 13;
		add(image96x96_3, gbc_image96x96_3);

		lblNewLabel_2 = new JLabel("125Wx90H");
		GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
		gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_2.gridx = 0;
		gbc_lblNewLabel_2.gridy = 14;
		add(lblNewLabel_2, gbc_lblNewLabel_2);

		image125x90 = new JImageName();
		image125x90.setMatchText("@VARIANT_{0}_IMAGE_NAME@125x90.png");
		image125x90.setFindText("@IMAGE_FILE_{0}_125Wx90H@");
		GridBagConstraints gbc_textFieldReplace_1 = new GridBagConstraints();
		gbc_textFieldReplace_1.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_1.gridx = 1;
		gbc_textFieldReplace_1.gridy = 14;
		add(image125x90, gbc_textFieldReplace_1);

		checkImage125x90 = new JCheckFlagBlock();
		checkImage125x90.setTrueText("$1");
		checkImage125x90.setFindText("@IMAGE_FILE_BLOCK_{0}_125Wx90H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_125Wx90H:END@");
		GridBagConstraints gbc_checkFlagBlock_2 = new GridBagConstraints();
		gbc_checkFlagBlock_2.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_2.gridx = 2;
		gbc_checkFlagBlock_2.gridy = 14;
		add(checkImage125x90, gbc_checkFlagBlock_2);

		lblwxh = new JLabel("128Wx114H");
		GridBagConstraints gbc_lblwxh = new GridBagConstraints();
		gbc_lblwxh.anchor = GridBagConstraints.EAST;
		gbc_lblwxh.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh.gridx = 0;
		gbc_lblwxh.gridy = 15;
		add(lblwxh, gbc_lblwxh);

		image128x114 = new JImageName();
		image128x114.setMatchText("@VARIANT_{0}_IMAGE_NAME@128x114.png");
		image128x114.setFindText("@IMAGE_FILE_{0}_128Wx114H@");
		GridBagConstraints gbc_textFieldReplace_2 = new GridBagConstraints();
		gbc_textFieldReplace_2.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_2.gridx = 1;
		gbc_textFieldReplace_2.gridy = 15;
		add(image128x114, gbc_textFieldReplace_2);

		checkImage128x114 = new JCheckFlagBlock();
		checkImage128x114.setTrueText("$1");
		checkImage128x114.setFindText("@IMAGE_FILE_BLOCK_{0}_128Wx114H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_128Wx114H:END@");
		GridBagConstraints gbc_checkFlagBlock_3 = new GridBagConstraints();
		gbc_checkFlagBlock_3.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_3.gridx = 2;
		gbc_checkFlagBlock_3.gridy = 15;
		add(checkImage128x114, gbc_checkFlagBlock_3);

		lblwxh_1 = new JLabel("128Wx85H");
		GridBagConstraints gbc_lblwxh_1 = new GridBagConstraints();
		gbc_lblwxh_1.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_1.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_1.gridx = 0;
		gbc_lblwxh_1.gridy = 16;
		add(lblwxh_1, gbc_lblwxh_1);

		image128x85 = new JImageName();
		image128x85.setMatchText("@VARIANT_{0}_IMAGE_NAME@128x85.png");
		image128x85.setFindText("@IMAGE_FILE_{0}_128Wx85H@");
		GridBagConstraints gbc_textFieldReplace_3 = new GridBagConstraints();
		gbc_textFieldReplace_3.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_3.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_3.gridx = 1;
		gbc_textFieldReplace_3.gridy = 16;
		add(image128x85, gbc_textFieldReplace_3);

		checkImage128x85 = new JCheckFlagBlock();
		checkImage128x85.setTrueText("$1");
		checkImage128x85.setFindText("@IMAGE_FILE_BLOCK_{0}_128Wx85H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_128Wx85H:END@");
		GridBagConstraints gbc_checkFlagBlock_4 = new GridBagConstraints();
		gbc_checkFlagBlock_4.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_4.gridx = 2;
		gbc_checkFlagBlock_4.gridy = 16;
		add(checkImage128x85, gbc_checkFlagBlock_4);

		lblwxh_2 = new JLabel("130Wx130H");
		GridBagConstraints gbc_lblwxh_2 = new GridBagConstraints();
		gbc_lblwxh_2.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_2.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_2.gridx = 0;
		gbc_lblwxh_2.gridy = 17;
		add(lblwxh_2, gbc_lblwxh_2);

		image130x130 = new JImageName();
		image130x130.setMatchText("@VARIANT_{0}_IMAGE_NAME@130x130.png");
		image130x130.setFindText("@IMAGE_FILE_{0}_130Wx130H@");
		GridBagConstraints gbc_textFieldReplace_4 = new GridBagConstraints();
		gbc_textFieldReplace_4.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_4.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_4.gridx = 1;
		gbc_textFieldReplace_4.gridy = 17;
		add(image130x130, gbc_textFieldReplace_4);

		checkImage130x130 = new JCheckFlagBlock();
		checkImage130x130.setTrueText("$1");
		checkImage130x130.setFindText("@IMAGE_FILE_BLOCK_{0}_130Wx130H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_130Wx130H:END@");
		GridBagConstraints gbc_checkFlagBlock_5 = new GridBagConstraints();
		gbc_checkFlagBlock_5.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_5.gridx = 2;
		gbc_checkFlagBlock_5.gridy = 17;
		add(checkImage130x130, gbc_checkFlagBlock_5);

		lblwxh_3 = new JLabel("130Wx80H");
		GridBagConstraints gbc_lblwxh_3 = new GridBagConstraints();
		gbc_lblwxh_3.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_3.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_3.gridx = 0;
		gbc_lblwxh_3.gridy = 18;
		add(lblwxh_3, gbc_lblwxh_3);

		image130x80 = new JImageName();
		image130x80.setMatchText("@VARIANT_{0}_IMAGE_NAME@130x80.png");
		image130x80.setFindText("@IMAGE_FILE_{0}_130Wx80H@");
		GridBagConstraints gbc_textFieldReplace_5 = new GridBagConstraints();
		gbc_textFieldReplace_5.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_5.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_5.gridx = 1;
		gbc_textFieldReplace_5.gridy = 18;
		add(image130x80, gbc_textFieldReplace_5);

		checkImage130x80 = new JCheckFlagBlock();
		checkImage130x80.setTrueText("$1");
		checkImage130x80.setFindText("@IMAGE_FILE_BLOCK_{0}_130Wx80H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_130Wx80H:END@");
		GridBagConstraints gbc_checkFlagBlock_6 = new GridBagConstraints();
		gbc_checkFlagBlock_6.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_6.gridx = 2;
		gbc_checkFlagBlock_6.gridy = 18;
		add(checkImage130x80, gbc_checkFlagBlock_6);

		lblwxh_4 = new JLabel("138Wx80H");
		GridBagConstraints gbc_lblwxh_4 = new GridBagConstraints();
		gbc_lblwxh_4.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_4.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_4.gridx = 0;
		gbc_lblwxh_4.gridy = 19;
		add(lblwxh_4, gbc_lblwxh_4);

		image138x80 = new JImageName();
		image138x80.setMatchText("@VARIANT_{0}_IMAGE_NAME@138x80.png");
		image138x80.setFindText("@IMAGE_FILE_{0}_138Wx80H@");
		GridBagConstraints gbc_textFieldReplace_6 = new GridBagConstraints();
		gbc_textFieldReplace_6.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_6.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_6.gridx = 1;
		gbc_textFieldReplace_6.gridy = 19;
		add(image138x80, gbc_textFieldReplace_6);

		checkImage138x80 = new JCheckFlagBlock();
		checkImage138x80.setTrueText("$1");
		checkImage138x80.setFindText("@IMAGE_FILE_BLOCK_{0}_138Wx80H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_138Wx80H:END@");
		GridBagConstraints gbc_checkFlagBlock_7 = new GridBagConstraints();
		gbc_checkFlagBlock_7.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_7.gridx = 2;
		gbc_checkFlagBlock_7.gridy = 19;
		add(checkImage138x80, gbc_checkFlagBlock_7);

		lblwxh_5 = new JLabel("164Wx115H");
		GridBagConstraints gbc_lblwxh_5 = new GridBagConstraints();
		gbc_lblwxh_5.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_5.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_5.gridx = 0;
		gbc_lblwxh_5.gridy = 20;
		add(lblwxh_5, gbc_lblwxh_5);

		image164x115 = new JImageName();
		image164x115.setMatchText("@VARIANT_{0}_IMAGE_NAME@164x115.png");
		image164x115.setFindText("@IMAGE_FILE_{0}_164Wx115H@");
		GridBagConstraints gbc_textFieldReplace_7 = new GridBagConstraints();
		gbc_textFieldReplace_7.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_7.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_7.gridx = 1;
		gbc_textFieldReplace_7.gridy = 20;
		add(image164x115, gbc_textFieldReplace_7);

		checkImage164x115 = new JCheckFlagBlock();
		checkImage164x115.setTrueText("$1");
		checkImage164x115.setFindText("@IMAGE_FILE_BLOCK_{0}_164Wx115H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_164Wx115H:END@");
		GridBagConstraints gbc_checkFlagBlock_8 = new GridBagConstraints();
		gbc_checkFlagBlock_8.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_8.gridx = 2;
		gbc_checkFlagBlock_8.gridy = 20;
		add(checkImage164x115, gbc_checkFlagBlock_8);

		lblwxh_6 = new JLabel("220Wx120H");
		GridBagConstraints gbc_lblwxh_6 = new GridBagConstraints();
		gbc_lblwxh_6.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_6.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_6.gridx = 0;
		gbc_lblwxh_6.gridy = 21;
		add(lblwxh_6, gbc_lblwxh_6);

		image220x120 = new JImageName();
		image220x120.setMatchText("@VARIANT_{0}_IMAGE_NAME@220x120.png");
		image220x120.setFindText("@IMAGE_FILE_{0}_220Wx120H@");
		GridBagConstraints gbc_textFieldReplace_8 = new GridBagConstraints();
		gbc_textFieldReplace_8.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_8.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_8.gridx = 1;
		gbc_textFieldReplace_8.gridy = 21;
		add(image220x120, gbc_textFieldReplace_8);

		checkImage220x120 = new JCheckFlagBlock();
		checkImage220x120.setTrueText("$1");
		checkImage220x120.setFindText("@IMAGE_FILE_BLOCK_{0}_220Wx120H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_220Wx120H:END@");
		GridBagConstraints gbc_checkFlagBlock_9 = new GridBagConstraints();
		gbc_checkFlagBlock_9.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_9.gridx = 2;
		gbc_checkFlagBlock_9.gridy = 21;
		add(checkImage220x120, gbc_checkFlagBlock_9);

		lblwxh_7 = new JLabel("300Wx180H");
		GridBagConstraints gbc_lblwxh_7 = new GridBagConstraints();
		gbc_lblwxh_7.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_7.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_7.gridx = 0;
		gbc_lblwxh_7.gridy = 22;
		add(lblwxh_7, gbc_lblwxh_7);

		image300x180 = new JImageName();
		image300x180.setMatchText("@VARIANT_{0}_IMAGE_NAME@300x180.png");
		image300x180.setFindText("@IMAGE_FILE_{0}_300Wx180H@");
		GridBagConstraints gbc_textFieldReplace_9 = new GridBagConstraints();
		gbc_textFieldReplace_9.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_9.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_9.gridx = 1;
		gbc_textFieldReplace_9.gridy = 22;
		add(image300x180, gbc_textFieldReplace_9);

		checkImage300x180 = new JCheckFlagBlock();
		checkImage300x180.setTrueText("$1");
		checkImage300x180.setFindText("@IMAGE_FILE_BLOCK_{0}_300Wx180H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_300Wx180H:END@");
		GridBagConstraints gbc_checkFlagBlock_10 = new GridBagConstraints();
		gbc_checkFlagBlock_10.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_10.gridx = 2;
		gbc_checkFlagBlock_10.gridy = 22;
		add(checkImage300x180, gbc_checkFlagBlock_10);

		lblwxh_8 = new JLabel("30Wx32H");
		GridBagConstraints gbc_lblwxh_8 = new GridBagConstraints();
		gbc_lblwxh_8.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_8.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_8.gridx = 0;
		gbc_lblwxh_8.gridy = 23;
		add(lblwxh_8, gbc_lblwxh_8);

		image30x32 = new JImageName();
		image30x32.setMatchText("@VARIANT_{0}_IMAGE_NAME@30x32.png");
		image30x32.setFindText("@IMAGE_FILE_{0}_30Wx32H@");
		GridBagConstraints gbc_textFieldReplace_10 = new GridBagConstraints();
		gbc_textFieldReplace_10.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldReplace_10.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldReplace_10.gridx = 1;
		gbc_textFieldReplace_10.gridy = 23;
		add(image30x32, gbc_textFieldReplace_10);

		checkImage30x32 = new JCheckFlagBlock();
		checkImage30x32.setTrueText("$1");
		checkImage30x32.setFindText("@IMAGE_FILE_BLOCK_{0}_30Wx32H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_30Wx32H:END@");
		GridBagConstraints gbc_checkFlagBlock_11 = new GridBagConstraints();
		gbc_checkFlagBlock_11.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_11.gridx = 2;
		gbc_checkFlagBlock_11.gridy = 23;
		add(checkImage30x32, gbc_checkFlagBlock_11);

		lblwxh_9 = new JLabel("300Wx300H");
		GridBagConstraints gbc_lblwxh_9 = new GridBagConstraints();
		gbc_lblwxh_9.anchor = GridBagConstraints.EAST;
		gbc_lblwxh_9.insets = new Insets(0, 0, 5, 5);
		gbc_lblwxh_9.gridx = 0;
		gbc_lblwxh_9.gridy = 24;
		add(lblwxh_9, gbc_lblwxh_9);

		image300x300_1 = new JImageName();
		image300x300_1.setMatchText("@VARIANT_{0}_IMAGE_NAME@(?:480x316|359x485|300x465|392x343|472x263|290x283)(?:_1)?\\.png");
		image300x300_1.setFindText("@IMAGE_FILE_{0}_300Wx300H_1@");
		GridBagConstraints gbc_image300x300_1 = new GridBagConstraints();
		gbc_image300x300_1.insets = new Insets(0, 0, 5, 5);
		gbc_image300x300_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_image300x300_1.gridx = 1;
		gbc_image300x300_1.gridy = 24;
		add(image300x300_1, gbc_image300x300_1);

		checkImage300x300 = new JCheckFlagBlock();
		checkImage300x300.setTrueText("$1");
		checkImage300x300.setFindText("@IMAGE_FILE_BLOCK_{0}_300Wx300H:START@(.+?)@IMAGE_FILE_BLOCK_{0}_300Wx300H:END@");
		GridBagConstraints gbc_checkFlagBlock_12 = new GridBagConstraints();
		gbc_checkFlagBlock_12.insets = new Insets(0, 0, 5, 0);
		gbc_checkFlagBlock_12.gridx = 2;
		gbc_checkFlagBlock_12.gridy = 24;
		add(checkImage300x300, gbc_checkFlagBlock_12);

		image300x300_2 = new JImageName();
		image300x300_2.setMatchText("@VARIANT_{0}_IMAGE_NAME@(?:480x316|359x485|300x465|392x343|472x263|290x283)(?:_2)\\.png");
		image300x300_2.setFindText("@IMAGE_FILE_{0}_300Wx300H_2@");
		GridBagConstraints gbc_image300x300_2 = new GridBagConstraints();
		gbc_image300x300_2.insets = new Insets(0, 0, 5, 5);
		gbc_image300x300_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_image300x300_2.gridx = 1;
		gbc_image300x300_2.gridy = 25;
		add(image300x300_2, gbc_image300x300_2);

		image300x300_3 = new JImageName();
		image300x300_3.setMatchText("@VARIANT_{0}_IMAGE_NAME@(?:480x316|359x485|300x465|392x343|472x263|290x283)(?:_3)\\.png");
		image300x300_3.setFindText("@IMAGE_FILE_{0}_300Wx300H_3@");
		GridBagConstraints gbc_image300x300_3 = new GridBagConstraints();
		gbc_image300x300_3.insets = new Insets(0, 0, 5, 5);
		gbc_image300x300_3.fill = GridBagConstraints.HORIZONTAL;
		gbc_image300x300_3.gridx = 1;
		gbc_image300x300_3.gridy = 26;
		add(image300x300_3, gbc_image300x300_3);

		panel = new JPanel();
		GridBagConstraints gbc_panel = new GridBagConstraints();
		gbc_panel.anchor = GridBagConstraints.SOUTHEAST;
		gbc_panel.gridwidth = 2;
		gbc_panel.gridx = 1;
		gbc_panel.gridy = 27;
		add(panel, gbc_panel);
		panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

		initPanel(variantNumber);
	}

	private void initPanel(int variantNumber)
	{
		image96x96_1.setCheckFlagBlock(checkImage96x96);
		image125x90.setCheckFlagBlock(checkImage125x90);
		image128x114.setCheckFlagBlock(checkImage128x114);
		image128x85.setCheckFlagBlock(checkImage128x85);
		image130x130.setCheckFlagBlock(checkImage130x130);
		image130x80.setCheckFlagBlock(checkImage130x80);
		image138x80.setCheckFlagBlock(checkImage138x80);
		image164x115.setCheckFlagBlock(checkImage164x115);
		image220x120.setCheckFlagBlock(checkImage220x120);
		image300x180.setCheckFlagBlock(checkImage300x180);
		image30x32.setCheckFlagBlock(checkImage30x32);
		image300x300_1.setCheckFlagBlock(checkImage300x300);

		for (Component component : ComponentUtils.getAllComponents(this))
		{
			if (component instanceof IReplace && ((IReplace) component).getFindText() != null
					&& ((IReplace) component).getFindText().length() > 0)
			{
				mapStringIReplace.put(((IReplace) component).getFindText(), (IReplace) component);
				((IReplace) component).setFindText(((IReplace) component).getFindText().replaceAll("\\{0\\}", variantNumber + ""));
				System.out.println(((IReplace) component).getFindText());
			}
		}
		for (HasCheckMatchText checkMatchText : ComponentUtils.getAllComponents(this, JImageName.class))
		{
			checkMatchText.setMatchText(checkMatchText.getMatchText().replace("{0}", variantNumber + ""));
		}
	}

	private void copy()
	{
		panelVariantCopy = JPanelVariant.this;
	}

	private void paste()
	{
		if (panelVariantCopy != null)
		{
			for (Entry<String, IReplace> entry : mapStringIReplace.entrySet())
			{
				if (entry.getValue() != null && panelVariantCopy.mapStringIReplace.get(entry.getKey()) != null)
				{
					entry.getValue().setReplaceText(panelVariantCopy.mapStringIReplace.get(entry.getKey()).getReplaceText());
				}
			}
		}
	}
}
